package com.iwayin.core.dao.fans;

import java.util.List;

import com.iwayin.core.dao.BaseDAOImpl;
import com.iwayin.core.dataobject.FansDO;
import com.iwayin.core.dataobject.FollowDO;

public class FansDAOImpl extends BaseDAOImpl implements FansDAO {

	@Override
	public void addFans(FansDO fans) {
		executeInsert("FansDAO.addFans", fans);
	}

	@Override
	public void addFans(FollowDO follow) {
		FansDO fans = new FansDO();
		fans.setUserId(follow.getFollowId());
		fans.setFansId(follow.getUserId());
		this.addFans(fans);
	}

	@Override
	public void deleteFans(FollowDO follow) {
		FansDO fans = new FansDO();
		fans.setUserId(follow.getFollowId());
		fans.setFansId(follow.getUserId());
		this.deleteFans(fans);
	}

	@Override
	public void deleteFans(FansDO fans) {
		executeDelete("FansDAO.deleteFans", fans);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<FansDO> findFansList(FansDO query) {
		return executeQueryForList("FansDAO.findFansList", "FansDAO.findFansList.count", query);
	}
	
	@Override
	public List<FansDO> FindFansMostToday(Long size) {
		return queryForList("FansDAO.FindFansMostToday",size);
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public List<Long> findFansIds(Long userId) {
		return this.getSqlMapClientTemplate().queryForList("FansDAO.findFansIds", userId);
	}
}
